<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Origami::ContentStream</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Origami::ContentStream</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/origami/graphics/xobject_rb.html">
                origami/graphics/xobject.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Stream.html">
                Stream
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
A class representing a <a href="Stream.html">Stream</a> containing the
contents of a <a href="Page.html">Page</a>.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000555">draw_line</a>&nbsp;&nbsp;
      <a href="#M000556">draw_polygon</a>&nbsp;&nbsp;
      <a href="#M000557">draw_rectangle</a>&nbsp;&nbsp;
      <a href="#M000554">instructions</a>&nbsp;&nbsp;
      <a href="#M000553">new</a>&nbsp;&nbsp;
      <a href="#M000559">paint_shading</a>&nbsp;&nbsp;
      <a href="#M000570">set_dash_pattern</a>&nbsp;&nbsp;
      <a href="#M000568">set_fill_color</a>&nbsp;&nbsp;
      <a href="#M000572">set_line_cap</a>&nbsp;&nbsp;
      <a href="#M000573">set_line_join</a>&nbsp;&nbsp;
      <a href="#M000571">set_line_width</a>&nbsp;&nbsp;
      <a href="#M000569">set_stroke_color</a>&nbsp;&nbsp;
      <a href="#M000567">set_text_char_spacing</a>&nbsp;&nbsp;
      <a href="#M000560">set_text_font</a>&nbsp;&nbsp;
      <a href="#M000562">set_text_leading</a>&nbsp;&nbsp;
      <a href="#M000561">set_text_pos</a>&nbsp;&nbsp;
      <a href="#M000563">set_text_rendering</a>&nbsp;&nbsp;
      <a href="#M000564">set_text_rise</a>&nbsp;&nbsp;
      <a href="#M000565">set_text_scale</a>&nbsp;&nbsp;
      <a href="#M000566">set_text_word_spacing</a>&nbsp;&nbsp;
      <a href="#M000558">write</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">


    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_SIZE</td>
          <td>=</td>
          <td class="context-item-value">12</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_FONT</td>
          <td>=</td>
          <td class="context-item-value">:F1</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_LEADING</td>
          <td>=</td>
          <td class="context-item-value">20</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_STROKE_COLOR</td>
          <td>=</td>
          <td class="context-item-value">Graphics::Color::GrayScale.new(0.0)</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_FILL_COLOR</td>
          <td>=</td>
          <td class="context-item-value">Graphics::Color::GrayScale.new(1.0)</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_LINECAP</td>
          <td>=</td>
          <td class="context-item-value">Graphics::LineCapStyle::BUTT_CAP</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_LINEJOIN</td>
          <td>=</td>
          <td class="context-item-value">Graphics::LineJoinStyle::MITER_JOIN</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_DASHPATTERN</td>
          <td>=</td>
          <td class="context-item-value">Graphics::DashPattern.new([], 0)</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_LINEWIDTH</td>
          <td>=</td>
          <td class="context-item-value">1.0</td>
        </tr>
        </table>
      </div>
    </div>



    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">instructions</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000553" class="method-detail">
        <a name="M000553"></a>

        <div class="method-heading">
          <a href="#M000553" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(rawdata = &quot;&quot;, dictionary = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000553-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000553-source">
<pre>
    <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 45</span>
45:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">rawdata</span> = <span class="ruby-value str">&quot;&quot;</span>, <span class="ruby-identifier">dictionary</span> = {})
46:     
47:       <span class="ruby-ivar">@instructions</span> = <span class="ruby-keyword kw">nil</span>
48:       <span class="ruby-ivar">@gs</span> = <span class="ruby-constant">Graphics</span><span class="ruby-operator">::</span><span class="ruby-constant">State</span>.<span class="ruby-identifier">new</span>
49: 
50:       <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">rawdata</span>, <span class="ruby-identifier">dictionary</span>)
51:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000555" class="method-detail">
        <a name="M000555"></a>

        <div class="method-heading">
          <a href="#M000555" class="method-signature">
          <span class="method-name">draw_line</span><span class="method-args">(from, to, attr = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Draw a straight line from the point at coord <em>from</em>, to the point at
coord <em>to</em>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000555-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000555-source">
<pre>
    <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 62</span>
62:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_line</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>, <span class="ruby-identifier">attr</span> = {})
63:       <span class="ruby-identifier">draw_polygon</span>([<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>], <span class="ruby-identifier">attr</span>)
64:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000556" class="method-detail">
        <a name="M000556"></a>

        <div class="method-heading">
          <a href="#M000556" class="method-signature">
          <span class="method-name">draw_polygon</span><span class="method-args">(coords = [], attr = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Draw a polygon from a array of coordinates.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000556-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000556-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 69</span>
 69:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_polygon</span>(<span class="ruby-identifier">coords</span> = [], <span class="ruby-identifier">attr</span> = {})
 70:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
 71: 
 72:       <span class="ruby-identifier">stroke_color</span>  = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:stroke_color</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_STROKE_COLOR</span>
 73:       <span class="ruby-identifier">fill_color</span>    = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:fill_color</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_FILL_COLOR</span>
 74:       <span class="ruby-identifier">line_cap</span>      = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:line_cap</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_LINECAP</span>
 75:       <span class="ruby-identifier">line_join</span>     = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:line_join</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_LINEJOIN</span>
 76:       <span class="ruby-identifier">line_width</span>    = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:line_width</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_LINEWIDTH</span>
 77:       <span class="ruby-identifier">dash_pattern</span>  = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:dash</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_DASHPATTERN</span>
 78: 
 79:       <span class="ruby-identifier">stroke</span>        = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:stroke</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:stroke</span>]
 80:       <span class="ruby-identifier">fill</span>          = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:fill</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">false</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:fill</span>]
 81: 
 82:       <span class="ruby-identifier">stroke</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fill</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">stroke</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span> 
 83: 
 84:       <span class="ruby-identifier">set_fill_color</span>(<span class="ruby-identifier">fill_color</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fill</span>
 85:       <span class="ruby-identifier">set_stroke_color</span>(<span class="ruby-identifier">stroke_color</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stroke</span>
 86:       <span class="ruby-identifier">set_line_width</span>(<span class="ruby-identifier">line_width</span>)
 87:       <span class="ruby-identifier">set_line_cap</span>(<span class="ruby-identifier">line_cap</span>)
 88:       <span class="ruby-identifier">set_line_join</span>(<span class="ruby-identifier">line_join</span>)
 89:       <span class="ruby-identifier">set_dash_pattern</span>(<span class="ruby-identifier">dash_pattern</span>)
 90:    
 91:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">is_in_text_object?</span>
 92:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'ET'</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
 93:       <span class="ruby-keyword kw">end</span>
 94: 
 95:       <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">coords</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span>
 96:         <span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span> = <span class="ruby-identifier">coords</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>)
 97:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'m'</span>,<span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
 98: 
 99:         <span class="ruby-identifier">coords</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">px</span>,<span class="ruby-identifier">py</span><span class="ruby-operator">|</span>
100:           <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'l'</span>,<span class="ruby-identifier">px</span>,<span class="ruby-identifier">py</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
101:         <span class="ruby-keyword kw">end</span>
102: 
103:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">i</span> =
104:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stroke</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">fill</span>
105:             <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'s'</span>)
106:           <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">fill</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">stroke</span>
107:             <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'f'</span>)
108:           <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">fill</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">stroke</span>
109:             <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'b'</span>)
110:           <span class="ruby-keyword kw">end</span>
111:         )
112: 
113:         <span class="ruby-identifier">i</span>.<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
114:       <span class="ruby-keyword kw">end</span>
115: 
116:       <span class="ruby-keyword kw">self</span>
117:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000557" class="method-detail">
        <a name="M000557"></a>

        <div class="method-heading">
          <a href="#M000557" class="method-signature">
          <span class="method-name">draw_rectangle</span><span class="method-args">(x, y, width, height, attr = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Draw a rectangle at position (<em>x</em>,<em>y</em>) with defined
<em>width</em> and <em>height</em>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000557-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000557-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 122</span>
122:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_rectangle</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>, <span class="ruby-identifier">width</span>, <span class="ruby-identifier">height</span>, <span class="ruby-identifier">attr</span> = {})
123:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
124: 
125:       <span class="ruby-identifier">stroke_color</span>  = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:stroke_color</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_STROKE_COLOR</span>
126:       <span class="ruby-identifier">fill_color</span>    = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:fill_color</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_FILL_COLOR</span>
127:       <span class="ruby-identifier">line_cap</span>      = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:line_cap</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_LINECAP</span>
128:       <span class="ruby-identifier">line_join</span>     = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:line_join</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_LINEJOIN</span>
129:       <span class="ruby-identifier">line_width</span>    = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:line_width</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_LINEWIDTH</span>
130:       <span class="ruby-identifier">dash_pattern</span>  = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:dash</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_DASHPATTERN</span>
131: 
132:       <span class="ruby-identifier">stroke</span>        = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:stroke</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:stroke</span>]
133:       <span class="ruby-identifier">fill</span>          = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:fill</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">false</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:fill</span>]
134: 
135:       <span class="ruby-identifier">stroke</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fill</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">stroke</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span> 
136: 
137:       <span class="ruby-identifier">set_fill_color</span>(<span class="ruby-identifier">fill_color</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fill</span>
138:       <span class="ruby-identifier">set_stroke_color</span>(<span class="ruby-identifier">stroke_color</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stroke</span>
139:       <span class="ruby-identifier">set_line_width</span>(<span class="ruby-identifier">line_width</span>)
140:       <span class="ruby-identifier">set_line_cap</span>(<span class="ruby-identifier">line_cap</span>)
141:       <span class="ruby-identifier">set_line_join</span>(<span class="ruby-identifier">line_join</span>)
142:       <span class="ruby-identifier">set_dash_pattern</span>(<span class="ruby-identifier">dash_pattern</span>)
143: 
144:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">is_in_text_object?</span>
145:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'ET'</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
146:       <span class="ruby-keyword kw">end</span>
147: 
148:       <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'re'</span>, <span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span>,<span class="ruby-identifier">width</span>,<span class="ruby-identifier">height</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
149:   
150:       <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">i</span> =
151:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stroke</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">fill</span>
152:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'S'</span>)
153:         <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">fill</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">stroke</span>
154:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'f'</span>)
155:         <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">fill</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">stroke</span>
156:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'B'</span>)
157:         <span class="ruby-keyword kw">end</span>
158:       )
159: 
160:       <span class="ruby-identifier">i</span>.<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
161:       
162:       <span class="ruby-keyword kw">self</span>
163:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000554" class="method-detail">
        <a name="M000554"></a>

        <div class="method-heading">
          <a href="#M000554" class="method-signature">
          <span class="method-name">instructions</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000554-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000554-source">
<pre>
    <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 53</span>
53:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">instructions</span>
54:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
55: 
56:       <span class="ruby-ivar">@instructions</span>
57:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000559" class="method-detail">
        <a name="M000559"></a>

        <div class="method-heading">
          <a href="#M000559" class="method-signature">
          <span class="method-name">paint_shading</span><span class="method-args">(shade)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000559-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000559-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 209</span>
209:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">paint_shading</span>(<span class="ruby-identifier">shade</span>)
210:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
211:       <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'sh'</span>, <span class="ruby-identifier">shade</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
212: 
213:       <span class="ruby-keyword kw">self</span>
214:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000570" class="method-detail">
        <a name="M000570"></a>

        <div class="method-heading">
          <a href="#M000570" class="method-signature">
          <span class="method-name">set_dash_pattern</span><span class="method-args">(pattern)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000570-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000570-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 346</span>
346:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_dash_pattern</span>(<span class="ruby-identifier">pattern</span>)
347:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
348:       <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">dash_pattern</span>.<span class="ruby-identifier">eql?</span> <span class="ruby-identifier">pattern</span>
349:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'d'</span>, <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">array</span>, <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">phase</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
350:       <span class="ruby-keyword kw">end</span>
351: 
352:       <span class="ruby-keyword kw">self</span>
353:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000568" class="method-detail">
        <a name="M000568"></a>

        <div class="method-heading">
          <a href="#M000568" class="method-signature">
          <span class="method-name">set_fill_color</span><span class="method-args">(color)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000568-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000568-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 286</span>
286:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_fill_color</span>(<span class="ruby-identifier">color</span>)
287:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
288:       
289:       <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> ( <span class="ruby-identifier">i</span> =
290:         <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:r</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:g</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:b</span>) <span class="ruby-keyword kw">or</span> (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Array</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">3</span>)
291:           <span class="ruby-identifier">r</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:r</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">r</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">255</span>
292:           <span class="ruby-identifier">g</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:g</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">g</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">1</span>]).<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">255</span>
293:           <span class="ruby-identifier">b</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:b</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">b</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">2</span>]).<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">255</span>
294:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'rg'</span>, <span class="ruby-identifier">r</span>, <span class="ruby-identifier">g</span>, <span class="ruby-identifier">b</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">nonstroking_color</span> <span class="ruby-operator">!=</span> [<span class="ruby-identifier">r</span>,<span class="ruby-identifier">g</span>,<span class="ruby-identifier">b</span>]
295: 
296:         <span class="ruby-keyword kw">elsif</span> (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:c</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:m</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:y</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:k</span>) <span class="ruby-keyword kw">or</span> (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Array</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span>)
297:           <span class="ruby-identifier">c</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:c</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">c</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">to_f</span>
298:           <span class="ruby-identifier">m</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:m</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">m</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">1</span>]).<span class="ruby-identifier">to_f</span>
299:           <span class="ruby-identifier">y</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:y</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">2</span>]).<span class="ruby-identifier">to_f</span>
300:           <span class="ruby-identifier">k</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:k</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">k</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">3</span>]).<span class="ruby-identifier">to_f</span>
301:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'k'</span>, <span class="ruby-identifier">c</span>, <span class="ruby-identifier">m</span>, <span class="ruby-identifier">y</span>, <span class="ruby-identifier">k</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">nonstroking_color</span> <span class="ruby-operator">!=</span> [<span class="ruby-identifier">c</span>,<span class="ruby-identifier">m</span>,<span class="ruby-identifier">y</span>,<span class="ruby-identifier">k</span>]
302:           
303:         <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span><span class="ruby-identifier">:g</span> <span class="ruby-keyword kw">or</span> (<span class="ruby-value">0</span><span class="ruby-value">.0</span><span class="ruby-operator">..</span><span class="ruby-value">1.0</span>) <span class="ruby-operator">===</span> <span class="ruby-identifier">color</span> 
304:           <span class="ruby-identifier">g</span> = <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:g</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">g</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>
305:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'g'</span>, <span class="ruby-identifier">g</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">nonstroking_color</span> <span class="ruby-operator">!=</span> [ <span class="ruby-identifier">g</span> ]
306: 
307:         <span class="ruby-keyword kw">else</span>
308:           <span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">&quot;Invalid color : #{color}&quot;</span>
309:         <span class="ruby-keyword kw">end</span>
310:       )
311: 
312:       <span class="ruby-identifier">i</span>.<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span>
313:       <span class="ruby-keyword kw">self</span> 
314:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000572" class="method-detail">
        <a name="M000572"></a>

        <div class="method-heading">
          <a href="#M000572" class="method-signature">
          <span class="method-name">set_line_cap</span><span class="method-args">(cap)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000572-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000572-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 364</span>
364:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_line_cap</span>(<span class="ruby-identifier">cap</span>)
365:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
366:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">line_cap</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">cap</span>
367:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'J'</span>, <span class="ruby-identifier">cap</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
368:       <span class="ruby-keyword kw">end</span>
369: 
370:       <span class="ruby-keyword kw">self</span>
371:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000573" class="method-detail">
        <a name="M000573"></a>

        <div class="method-heading">
          <a href="#M000573" class="method-signature">
          <span class="method-name">set_line_join</span><span class="method-args">(join)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000573-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000573-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 373</span>
373:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_line_join</span>(<span class="ruby-identifier">join</span>)
374:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
375:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">line_join</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">join</span>
376:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'j'</span>, <span class="ruby-identifier">join</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
377:       <span class="ruby-keyword kw">end</span>
378: 
379:       <span class="ruby-keyword kw">self</span>
380:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000571" class="method-detail">
        <a name="M000571"></a>

        <div class="method-heading">
          <a href="#M000571" class="method-signature">
          <span class="method-name">set_line_width</span><span class="method-args">(width)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000571-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000571-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 355</span>
355:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_line_width</span>(<span class="ruby-identifier">width</span>)
356:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
357:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">line_width</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">width</span>
358:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'w'</span>, <span class="ruby-identifier">width</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
359:       <span class="ruby-keyword kw">end</span>
360: 
361:       <span class="ruby-keyword kw">self</span>
362:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000569" class="method-detail">
        <a name="M000569"></a>

        <div class="method-heading">
          <a href="#M000569" class="method-signature">
          <span class="method-name">set_stroke_color</span><span class="method-args">(color)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000569-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000569-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 316</span>
316:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_stroke_color</span>(<span class="ruby-identifier">color</span>)
317:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
318:       
319:       <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> ( <span class="ruby-identifier">i</span> =
320:         <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:r</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:g</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:b</span>) <span class="ruby-keyword kw">or</span> (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Array</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">3</span>)
321:           <span class="ruby-identifier">r</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:r</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">r</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">255</span>
322:           <span class="ruby-identifier">g</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:g</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">g</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">1</span>]).<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">255</span>
323:           <span class="ruby-identifier">b</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:b</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">b</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">2</span>]).<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">255</span>
324:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'RG'</span>, <span class="ruby-identifier">r</span>, <span class="ruby-identifier">g</span>, <span class="ruby-identifier">b</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">stroking_color</span> <span class="ruby-operator">!=</span> [<span class="ruby-identifier">r</span>,<span class="ruby-identifier">g</span>,<span class="ruby-identifier">b</span>]
325: 
326:         <span class="ruby-keyword kw">elsif</span> (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:c</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:m</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:y</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:k</span>) <span class="ruby-keyword kw">or</span> (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Array</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span>)
327:           <span class="ruby-identifier">c</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:c</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">c</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">to_f</span>
328:           <span class="ruby-identifier">m</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:m</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">m</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">1</span>]).<span class="ruby-identifier">to_f</span>
329:           <span class="ruby-identifier">y</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:y</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">2</span>]).<span class="ruby-identifier">to_f</span>
330:           <span class="ruby-identifier">k</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:k</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">k</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">3</span>]).<span class="ruby-identifier">to_f</span>
331:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'K'</span>, <span class="ruby-identifier">c</span>, <span class="ruby-identifier">m</span>, <span class="ruby-identifier">y</span>, <span class="ruby-identifier">k</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">stroking_color</span> <span class="ruby-operator">!=</span> [<span class="ruby-identifier">c</span>,<span class="ruby-identifier">m</span>,<span class="ruby-identifier">y</span>,<span class="ruby-identifier">k</span>]
332:           
333:         <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span><span class="ruby-identifier">:g</span> <span class="ruby-keyword kw">or</span> (<span class="ruby-value">0</span><span class="ruby-value">.0</span><span class="ruby-operator">..</span><span class="ruby-value">1.0</span>) <span class="ruby-operator">===</span> <span class="ruby-identifier">color</span> 
334:           <span class="ruby-identifier">g</span> = <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:g</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">g</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>
335:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'G'</span>, <span class="ruby-identifier">g</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">stroking_color</span> <span class="ruby-operator">!=</span> [ <span class="ruby-identifier">g</span> ]
336: 
337:         <span class="ruby-keyword kw">else</span>
338:           <span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">&quot;Invalid color : #{color}&quot;</span>
339:         <span class="ruby-keyword kw">end</span>
340:       )
341: 
342:       <span class="ruby-identifier">i</span>.<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span>
343:       <span class="ruby-keyword kw">self</span> 
344:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000567" class="method-detail">
        <a name="M000567"></a>

        <div class="method-heading">
          <a href="#M000567" class="method-signature">
          <span class="method-name">set_text_char_spacing</span><span class="method-args">(char_spacing)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000567-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000567-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 277</span>
277:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_text_char_spacing</span>(<span class="ruby-identifier">char_spacing</span>)
278:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
279:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">char_spacing</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">char_spacing</span>
280:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Tc'</span>, <span class="ruby-identifier">char_spacing</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
281:       <span class="ruby-keyword kw">end</span>
282: 
283:       <span class="ruby-keyword kw">self</span>
284:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000560" class="method-detail">
        <a name="M000560"></a>

        <div class="method-heading">
          <a href="#M000560" class="method-signature">
          <span class="method-name">set_text_font</span><span class="method-args">(fontname, size)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000560-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000560-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 216</span>
216:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_text_font</span>(<span class="ruby-identifier">fontname</span>, <span class="ruby-identifier">size</span>)
217:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
218:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fontname</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">font</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">font_size</span>
219:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Tf'</span>, <span class="ruby-identifier">fontname</span>, <span class="ruby-identifier">size</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
220:       <span class="ruby-keyword kw">end</span>
221: 
222:       <span class="ruby-keyword kw">self</span>
223:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000562" class="method-detail">
        <a name="M000562"></a>

        <div class="method-heading">
          <a href="#M000562" class="method-signature">
          <span class="method-name">set_text_leading</span><span class="method-args">(leading)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000562-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000562-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 232</span>
232:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_text_leading</span>(<span class="ruby-identifier">leading</span>)
233:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
234:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">leading</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">leading</span>
235:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'TL'</span>, <span class="ruby-identifier">leading</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
236:       <span class="ruby-keyword kw">end</span>
237: 
238:       <span class="ruby-keyword kw">self</span>
239:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000561" class="method-detail">
        <a name="M000561"></a>

        <div class="method-heading">
          <a href="#M000561" class="method-signature">
          <span class="method-name">set_text_pos</span><span class="method-args">(tx,ty)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000561-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000561-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 225</span>
225:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_text_pos</span>(<span class="ruby-identifier">tx</span>,<span class="ruby-identifier">ty</span>)
226:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
227:       <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Td'</span>, <span class="ruby-identifier">tx</span>, <span class="ruby-identifier">ty</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
228:       
229:       <span class="ruby-keyword kw">self</span>
230:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000563" class="method-detail">
        <a name="M000563"></a>

        <div class="method-heading">
          <a href="#M000563" class="method-signature">
          <span class="method-name">set_text_rendering</span><span class="method-args">(rendering)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000563-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000563-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 241</span>
241:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_text_rendering</span>(<span class="ruby-identifier">rendering</span>)
242:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
243:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rendering</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">rendering_mode</span>
244:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Tr'</span>, <span class="ruby-identifier">rendering</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
245:       <span class="ruby-keyword kw">end</span>
246: 
247:       <span class="ruby-keyword kw">self</span>
248:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000564" class="method-detail">
        <a name="M000564"></a>

        <div class="method-heading">
          <a href="#M000564" class="method-signature">
          <span class="method-name">set_text_rise</span><span class="method-args">(rise)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000564-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000564-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 250</span>
250:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_text_rise</span>(<span class="ruby-identifier">rise</span>)
251:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
252:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rise</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">text_rise</span>
253:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Ts'</span>, <span class="ruby-identifier">rise</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
254:       <span class="ruby-keyword kw">end</span>
255:       
256:       <span class="ruby-keyword kw">self</span>
257:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000565" class="method-detail">
        <a name="M000565"></a>

        <div class="method-heading">
          <a href="#M000565" class="method-signature">
          <span class="method-name">set_text_scale</span><span class="method-args">(scaling)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000565-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000565-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 259</span>
259:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_text_scale</span>(<span class="ruby-identifier">scaling</span>)
260:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
261:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">scale</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">scaling</span>
262:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Tz'</span>, <span class="ruby-identifier">scaling</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
263:       <span class="ruby-keyword kw">end</span>
264: 
265:       <span class="ruby-keyword kw">self</span>
266:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000566" class="method-detail">
        <a name="M000566"></a>

        <div class="method-heading">
          <a href="#M000566" class="method-signature">
          <span class="method-name">set_text_word_spacing</span><span class="method-args">(word_spacing)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000566-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000566-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 268</span>
268:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_text_word_spacing</span>(<span class="ruby-identifier">word_spacing</span>)
269:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
270:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">word_spacing</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">word_spacing</span>
271:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Tw'</span>, <span class="ruby-identifier">word_spacing</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
272:       <span class="ruby-keyword kw">end</span>
273:       
274:       <span class="ruby-keyword kw">self</span>
275:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000558" class="method-detail">
        <a name="M000558"></a>

        <div class="method-heading">
          <a href="#M000558" class="method-signature">
          <span class="method-name">write</span><span class="method-args">(text, attr = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Adds text to the content stream with custom formatting attributes.
</p>
<table>
<tr><td valign="top"><em>text</em>:</td><td><a href="Text.html">Text</a> to <a
href="ContentStream.html#M000558">write</a>.

</td></tr>
<tr><td valign="top"><em>attr</em>:</td><td>Formatting attributes.

</td></tr>
</table>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000558-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000558-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 170</span>
170:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">write</span>(<span class="ruby-identifier">text</span>, <span class="ruby-identifier">attr</span> = {})
171:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
172: 
173:       <span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span>       = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:x</span>], <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:y</span>] 
174:       <span class="ruby-identifier">font</span>      = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:font</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_FONT</span>
175:       <span class="ruby-identifier">size</span>      = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:size</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_SIZE</span>
176:       <span class="ruby-identifier">leading</span>   = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:leading</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_LEADING</span>
177:       <span class="ruby-identifier">color</span>     = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:color</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:fill_color</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_STROKE_COLOR</span>
178:       <span class="ruby-identifier">stroke_color</span> = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:stroke_color</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_STROKE_COLOR</span>
179:       <span class="ruby-identifier">line_width</span>    = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:line_width</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_LINEWIDTH</span>
180:       <span class="ruby-identifier">word_spacing</span>  = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:word_spacing</span>]
181:       <span class="ruby-identifier">char_spacing</span>  = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:char_spacing</span>]
182:       <span class="ruby-identifier">scale</span>     = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:scale</span>]
183:       <span class="ruby-identifier">rise</span>      = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:rise</span>]
184:       <span class="ruby-identifier">rendering</span> = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:rendering</span>]
185: 
186:       <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'ET'</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>) <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">x</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">y</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">is_in_text_object?</span>
187: 
188:       <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">is_in_text_object?</span> 
189:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'BT'</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
190:       <span class="ruby-keyword kw">end</span>
191: 
192:       <span class="ruby-identifier">set_text_font</span>(<span class="ruby-identifier">font</span>, <span class="ruby-identifier">size</span>)
193:       <span class="ruby-identifier">set_text_pos</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">x</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">y</span>
194:       <span class="ruby-identifier">set_text_leading</span>(<span class="ruby-identifier">leading</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">leading</span>
195:       <span class="ruby-identifier">set_text_rendering</span>(<span class="ruby-identifier">rendering</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rendering</span>
196:       <span class="ruby-identifier">set_text_rise</span>(<span class="ruby-identifier">rise</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rise</span>
197:       <span class="ruby-identifier">set_text_scale</span>(<span class="ruby-identifier">scale</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">scale</span>
198:       <span class="ruby-identifier">set_text_word_spacing</span>(<span class="ruby-identifier">word_spacing</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">word_spacing</span>
199:       <span class="ruby-identifier">set_text_char_spacing</span>(<span class="ruby-identifier">char_spacing</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">char_spacing</span>
200:       <span class="ruby-identifier">set_fill_color</span>(<span class="ruby-identifier">color</span>)
201:       <span class="ruby-identifier">set_stroke_color</span>(<span class="ruby-identifier">stroke_color</span>) 
202:       <span class="ruby-identifier">set_line_width</span>(<span class="ruby-identifier">line_width</span>)
203: 
204:       <span class="ruby-identifier">write_text_block</span>(<span class="ruby-identifier">text</span>)
205:      
206:       <span class="ruby-keyword kw">self</span>
207:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>